<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注销审批</title>
<link rel="stylesheet" type="text/css" href="../../css/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../../css/themes/icon.css" />
<link href="../../css/style_01.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="../../js/ListData.js"></script>
<script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript">
	var userID = null;
	$(function() {
		$('#tt').datagrid({
			singleSelect : false,
			rownumbers : true,
			toolbar : '#tb',
			onClickRow : function(rowIndex, rowData) {
				execFrame(function(wind) {
					// 					wind.alterAction("../../member/logining");
					userID = rowData.id;
					wind.clearForm();
					wind.loadData(rowData);
					wind.readOnly();
				})
			}
		});
		loadData();
		$('#panel_edit').panel({});
	});
	function execFrame(fun) {
		var frame = $("iframe", $("#panel_edit").panel())[0];
		var wind = frame.contentWindow;
		if (wind && wind.loadData) {
			fun(wind);
		} else {
			if (frame.attachEvent) {
				frame.attachEvent("onload", function() {
					fun(frame.contentWindow);
				});
			} else {
				frame.onload = function() {
					fun(frame.contentWindow);
				};
			}
		}
	}
	function loadData() {
		$.get("../../member/logoffing", {}, function(str) {
			if (typeof str == "object" && str instanceof Array) {
				$('#tt').datagrid("loadData", str);
			}
		})
	}
	function agree() {
		$.post("../../member/statu/update", {
			id : userID,
			status : "LOGOFFED"
		}, function(str) {
			alert("提交成功");
			loadData();
			top.buildTree();
		});
	}
	function disagree() {
		$.post("../../member/statu/update", {
			id : userID,
			status : "LOGINED"
		}, function(str) {
			alert("提交成功");
			loadData();
			top.buildTree();
		});
	}
	function sexFormatter(value) {
		if ("1" == value) {
			return "男";
		} else if ("2" == value) {
			return "女";
		} else {
			return value;
		}
	}
	function politicalFormatter(value) {
		for ( var i = 0; i < list_politics_status.length; i++) {
			if (list_politics_status[i].value == value) {
				return list_politics_status[i].text;
			}
		}
		return value;
	}
	function maritalFormatter(value) {
		if ("1" == value) {
			return "未婚";
		} else if ("2" == value) {
			return "已婚";
		} else {
			return value;
		}
	}
	function educationalFormatter(value) {
		for ( var i = 0; i < list_degree.length; i++) {
			if (list_degree[i].value == value) {
				return list_degree[i].text;
			}
		}
		return value;
	}
	function batchAgree() {
		$($('#tt').datagrid("getChecked")).each(function(i, row) {
			row.status = "LOGOFFED";
			$.post("../../member/statu/update", row, function(str) {
				var index = $('#tt').datagrid("getRowIndex", row);
				$('#tt').datagrid("deleteRow", index);
			});
		});
	}
	function batchDisagree() {
		$($('#tt').datagrid("getChecked")).each(function(i, row) {
			row.status = "LOGINED";
			$.post("../../member/statu/update", row, function(str) {
				var index = $('#tt').datagrid("getRowIndex", row);
				$('#tt').datagrid("deleteRow", index);
			});
		});
	}
</script>
<style type="text/css">
body {
	text-align: center;
	margin: 0px;
	padding: 0px;
	width: 100%;
	height: 100%;
}
</style>
</head>
<body style="margin: 0">
	<table width="100%" height="45" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="88%" align="center" class="test_bt">退会审批</td>
		</tr>
	</table>
	<div id="tb">
		<div style="float: left">
			<a href="#" class="easyui-linkbutton" data-options="plain:true" id="but_allselect" onclick="javascript:$('#tt').datagrid('selectAll')">全选</a>
		</div>
		<div style="float: left">
			<a href="#" class="easyui-linkbutton" data-options="plain:true" id="but_allunselect" onclick="javascript:$('#tt').datagrid('unselectAll')">全不选</a>
		</div>
		<div style="float: left">
			<a href="#" class="easyui-linkbutton" data-options="plain:true" id="but_remove" onclick="javascript:batchAgree()">批量同意</a>
		</div>
		<div style="float: left">
			<a href="#" class="easyui-linkbutton" data-options="plain:true" id="but_refresh" onclick="javascript:batchDisagree()">批量不同意</a>
		</div>
	</div>
	<table id="tt" class="easyui-datagrid" data-options="" style="width: 100; height: 200px;">
		<thead>
			<tr>
				<th data-options="field:'id',width:80,checkbox:true"></th>
				<th data-options="field:'name',width:80">会员姓名</th>
				<th data-options="field:'sexual',width:80,formatter:sexFormatter,editor:{
							type:'combobox'}">性别</th>
				<th data-options="field:'political',width:80,formatter:politicalFormatter,editor:{
							type:'combobox'}">政治面貌</th>
				<th data-options="field:'marital',width:80,formatter:maritalFormatter,editor:{
							type:'combobox'}">婚姻</th>
				<th data-options="field:'educational',width:80,formatter:educationalFormatter,editor:{
							type:'combobox'}">学历</th>
				<th data-options="field:'tel',width:80">办公电话</th>
			</tr>
		</thead>
	</table>
	<hr />
	<div id="tb" style="width: 800px">
		<table width="100%" align="left">
			<tr>
				<td></td>
				<td><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" id="but_add" onclick="javascript:agree()">同意注销</a></td>
				<td><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" id="but_remove" onclick="javascript:disagree()">不同意注销</a></td>
				<td></td>
			</tr>
		</table>
	</div>
	<div id="panel_edit" style="width: 800px; height: 400px; clear: left;">
		<iframe id="frame_edit" width="100%" height="100%" frameborder="0" src="../function/member_base_edit.jsp?readonly=readonly"></iframe>
	</div>

</body>
</html>